#include<bits/stdc++.h>
using namespace std;
#define int long long

vector<int> mp = {13, 1, 2, 3, 5, 4, 4, 2, 2, 2};

int compute(int a, int b, int c) {
    int ans = 0;

    string s;

    s = to_string(a);
    while(s.size() < 4) s = "0" + s;
    for(auto ii : s) ans += mp[ii - '0'];

    s = to_string(b);
    while(s.size() < 2) s = "0" + s;
    for(auto ii : s) ans += mp[ii - '0'];

    s = to_string(c);
    while(s.size() < 2) s = "0" + s;
    for(auto ii : s) ans += mp[ii - '0'];

    return ans > 50;
}

signed main() {
//	system("start https://www.lanqiao.cn/problems/19937/learning/");

    vector<int> days = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    int ans = 0;

    for(int i = 2000; i < 2024; i++) {
        if(i % 4 == 0 && i % 100 || i % 400 == 0)
            days[2] = 29;
        else days[2] = 28;

        for(int j = 1; j <= 12; j++) {
            for(int k = 1; k <= days[j]; k++) {
                ans += compute(i, j, k);
            }
        }
    }

    int year = 2024;
    if(year % 4 == 0 && year % 100 || year % 400 == 0)
        days[2] = 29;
    else days[2] = 28;

    for(int i = 1; i < 4; i++)
        for(int j = 1; j <= days[i]; j++)
            ans += compute(year, i, j);

    int month = 4;
    for(int i = 1; i <= 13; i++)
        ans += compute(year, month, i);

    cout << ans;

    return 0;
}

